package com.yunzone.cloud.modules.account.controller;

import com.yunzone.cloud.common.entity.Result;
import com.yunzone.cloud.modules.account.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class StorageController {

    @Resource
    private StorageService storageService;

    @PostMapping(value = "storage/decrease")
    public Result decrease(@RequestParam("productId") Long productId,
                           @RequestParam("count") Integer count) {
        storageService.decrease(productId,count);
        return new Result(200,true, "扣减库存成功");
    }

}